package com.salesmonitoring.test;

import java.io.FileOutputStream;

import com.lowagie.text.Anchor;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;


public class Unique {
	
	public static void main(String[] args) {
		
		String[][] data = {
				{"one", "Net", "Runette"},
				{"two", "Kawoo", "Karlo"},
		};
		Document document=new Document(PageSize.LEGAL, 50, 50, 50, 50);
		
		
		try {
			PdfWriter.getInstance(document,new FileOutputStream("C:\\Reports\\New.pdf"));
		
			document.open();
	   
			Image bomLogo = Image.getInstance("images//logo.png");
			
			Anchor anchorTarget = new Anchor("\nSales Report");
			anchorTarget.setName("BackToTop");
	
			Paragraph paragraph1 = new Paragraph();
			paragraph1.setSpacingBefore(50);
			paragraph1.add(bomLogo);
			paragraph1.add(anchorTarget);
			
			PdfPTable table = new PdfPTable(3);
			table.setSpacingBefore(10);

			PdfPCell c1 = new PdfPCell(new Phrase("Blah"));
			PdfPCell c2 = new PdfPCell(new Phrase("Nickname"));
			PdfPCell c3 = new PdfPCell(new Phrase("Name"));
			
			table.addCell(c1);
			table.addCell(c2);
			table.addCell(c3);
			
			for(int x=0; x<data.length; x++) {
				for(int y=0; y<data[x].length; y++) {
					table.addCell(data[x][y]);
				}
			}
			
			document.add(paragraph1);
			document.add(table);
			document.close();
		
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
}